package cn.topevery.garden.dal.logic;

import cn.topevery.garden.dal.dao.BotanyTreeInfoDao;
import cn.topevery.garden.entity.po.BotanyTreeInfo;
import cn.topevery.garden.entity.query.BotanyTreeInfoQuery;
import cn.topevery.garden.framework.base.BaseLogic;
import hw.topevery.framework.db.base.BaseEntityDao;
import hw.topevery.framework.db.entity.DataPager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 
 *
 * @author code-generate
 * @date 2021-08-26
 */
@Service
public class BotanyTreeInfoLogic extends BaseLogic<BotanyTreeInfo> {
    @Autowired
    BotanyTreeInfoDao botanyTreeInfoDao;

    @Override
    public BaseEntityDao<BotanyTreeInfo, Integer> getDao() {
        return botanyTreeInfoDao;
    }

    

    /**
     * 获取列表
     *
     * @param query
     */
    public DataPager<BotanyTreeInfo> listPage(BotanyTreeInfoQuery query) {
        return botanyTreeInfoDao.listPage(query);
    }

    /**
     * 根据自增id批量删除
     *
     * @param ids
     */
    public void deleteBatchById(String userId,Integer[] ids) {
        botanyTreeInfoDao.delete(userId, ids);
    }

    /**
     * 根据自增id保存或者更新
     *
     * @param botanyTreeInfo 实体
     */
    public boolean saveOrUpdate(String userId, BotanyTreeInfo botanyTreeInfo){
        botanyTreeInfoDao.saveOrUpdate(userId,botanyTreeInfo);
        return true;
    }

    /**
     * 描述 Gets by id.
     *
     * @param id the id
     * @return the by id
     * @author wenzhao.lin
     * @created 2021 -08-25 10:56:00
     */
    public BotanyTreeInfo getById(Integer id) {
        BotanyTreeInfo entity= botanyTreeInfoDao.getEntity(id);
        return entity;
    }

    public boolean isExit(String fieldName, String value){
        return botanyTreeInfoDao.isExit(fieldName, value);
    }

    public Map getCount(String name, Integer extentId, String typeId){
        return botanyTreeInfoDao.getCount(name, extentId, typeId);
    }

    public List<BotanyTreeInfo> getListByType(String name, Integer extentId, String type){
        return botanyTreeInfoDao.getListByType(name, extentId, type);
    }

    public List<BotanyTreeInfo> getTypeList(String name, Integer extentId){
        return botanyTreeInfoDao.getTypeList(name, extentId);
    }
}
